package com.ycb.bookserver.mapper;

import com.book.enumeration.OperationType;
import com.ycb.book.entity.User;
import com.ycb.book.vo.UserReportVO;
import com.ycb.bookserver.annotation.AutoFill;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    @Select("select * from user where id_number = #{idNumber}")
    UserReportVO getUser(String idNumber);

    @Select("select * from user where id=#{id}")
    User getUserById(Long id);

    @AutoFill(value = OperationType.INSERT)
    @Insert("insert into user (name,connect,id_number) values (#{name},#{connect},#{idNumber})")
    void add(User user);

    @Select("select * from user where id_number = #{idNumber}")
    User getUserByIdNumber(Long idNumber);
    @Delete("delete from user where id = {id}")
    void delete(Integer id);
}
